VERSION 5.00
Object = "{736A8444-E374-41A8-B526-1B07FD2F3F5B}#1.0#0"; "BLacKPeaRLOCX.ocx"
Begin VB.Form FrmPesan 
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Kirim dan Terima Pesan"
   ClientHeight    =   5505
   ClientLeft      =   45
   ClientTop       =   465
   ClientWidth     =   7320
   Icon            =   "FrmPesan.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5505
   ScaleWidth      =   7320
   StartUpPosition =   2  'CenterScreen
   Begin BLacKPeaRLOCX.BLacKFrame BLacKFrame4 
      Height          =   5535
      Left            =   0
      TabIndex        =   5
      Top             =   0
      Width           =   7335
      _ExtentX        =   12938
      _ExtentY        =   9763
      BackColor1      =   0
      BackColor2      =   4210752
      Caption         =   "Pesan / Message"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   49152
      TitleColor1     =   0
      TitleColor2     =   4210752
      TitleGradient   =   2
      TitleHeight     =   350
      BorderColor     =   49152
      BorderWidth     =   2
      Begin BLacKPeaRLOCX.BLacKFrame BLacKFrame3 
         Height          =   735
         Left            =   240
         TabIndex        =   9
         Top             =   4560
         Width           =   6855
         _ExtentX        =   12091
         _ExtentY        =   1296
         BackColor1      =   0
         BackColor2      =   4210752
         Caption         =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   255
         TitleColor1     =   0
         TitleColor2     =   4210752
         TitleGradient   =   2
         TitleHeight     =   350
         BorderColor     =   49152
         BorderWidth     =   2
         Begin BLacKPeaRLOCX.ButtonNix CmdTutup 
            Height          =   375
            Left            =   5160
            TabIndex        =   4
            Top             =   120
            Width           =   1215
            _ExtentX        =   2143
            _ExtentY        =   661
            BTYPE           =   5
            TX              =   "Tutup"
            ENAB            =   -1  'True
            BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            COLTYPE         =   2
            FOCUSR          =   0   'False
            BCOL            =   1184274
            BCOLO           =   16777215
            FCOL            =   49152
            FCOLO           =   49152
            MCOL            =   12632256
            MPTR            =   1
            MICON           =   "FrmPesan.frx":628A
            UMCOL           =   -1  'True
            SOFT            =   0   'False
            PICPOS          =   0
            NGREY           =   0   'False
            FX              =   0
            HAND            =   0   'False
            CHECK           =   0   'False
            VALUE           =   0   'False
         End
         Begin BLacKPeaRLOCX.ButtonNix CmdHapusLog 
            Height          =   375
            Left            =   480
            TabIndex        =   2
            Top             =   120
            Width           =   1215
            _ExtentX        =   2143
            _ExtentY        =   661
            BTYPE           =   5
            TX              =   "Hapus"
            ENAB            =   -1  'True
            BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            COLTYPE         =   2
            FOCUSR          =   0   'False
            BCOL            =   1184274
            BCOLO           =   16777215
            FCOL            =   49152
            FCOLO           =   49152
            MCOL            =   12632256
            MPTR            =   1
            MICON           =   "FrmPesan.frx":62A6
            UMCOL           =   -1  'True
            SOFT            =   0   'False
            PICPOS          =   0
            NGREY           =   0   'False
            FX              =   0
            HAND            =   0   'False
            CHECK           =   0   'False
            VALUE           =   0   'False
         End
         Begin BLacKPeaRLOCX.ButtonNix CmdKirim 
            Height          =   375
            Left            =   2760
            TabIndex        =   3
            Top             =   120
            Width           =   1215
            _ExtentX        =   2143
            _ExtentY        =   661
            BTYPE           =   5
            TX              =   "Kirim"
            ENAB            =   -1  'True
            BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            COLTYPE         =   2
            FOCUSR          =   0   'False
            BCOL            =   1184274
            BCOLO           =   16777215
            FCOL            =   49152
            FCOLO           =   49152
            MCOL            =   12632256
            MPTR            =   1
            MICON           =   "FrmPesan.frx":62C2
            UMCOL           =   -1  'True
            SOFT            =   0   'False
            PICPOS          =   0
            NGREY           =   0   'False
            FX              =   0
            HAND            =   0   'False
            CHECK           =   0   'False
            VALUE           =   0   'False
         End
      End
      Begin BLacKPeaRLOCX.BLacKFrame BLacKFrame1 
         Height          =   735
         Left            =   240
         TabIndex        =   7
         Top             =   3720
         Width           =   6855
         _ExtentX        =   12091
         _ExtentY        =   1296
         BackColor1      =   0
         BackColor2      =   4210752
         Caption         =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   255
         TitleColor1     =   0
         TitleColor2     =   4210752
         TitleGradient   =   2
         TitleHeight     =   350
         BorderColor     =   49152
         BorderWidth     =   2
         Begin VB.TextBox TxtPesanDiKirim 
            BackColor       =   &H00404040&
            BorderStyle     =   0  'None
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H0000C000&
            Height          =   250
            Left            =   270
            TabIndex        =   0
            Top             =   165
            Width           =   4095
         End
         Begin VB.ComboBox txtNoClient 
            BackColor       =   &H00000000&
            ForeColor       =   &H0000C000&
            Height          =   315
            Left            =   5520
            TabIndex        =   1
            Top             =   120
            Width           =   975
         End
         Begin VB.Shape Shape2 
            BackColor       =   &H00004040&
            BackStyle       =   1  'Opaque
            BorderColor     =   &H00C0FFC0&
            Height          =   345
            Left            =   240
            Shape           =   4  'Rounded Rectangle
            Top             =   120
            Width           =   4170
         End
         Begin VB.Label Label1 
            BackStyle       =   0  'Transparent
            Caption         =   "Client"
            BeginProperty Font 
               Name            =   "OCR A Extended"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H0000C000&
            Height          =   255
            Left            =   4560
            TabIndex        =   8
            Top             =   120
            Width           =   615
         End
      End
      Begin BLacKPeaRLOCX.BLacKFrame BLacKFrame2 
         Height          =   3015
         Left            =   240
         TabIndex        =   6
         Top             =   480
         Width           =   6855
         _ExtentX        =   12091
         _ExtentY        =   5318
         BackColor1      =   0
         BackColor2      =   0
         BackGradient    =   0
         Caption         =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   255
         TitleColor1     =   2565927
         TitleColor2     =   2565927
         TitleGradient   =   0
         TitleHeight     =   350
         BorderColor     =   49152
         BorderWidth     =   2
         Begin VB.ListBox TxtpesanDiterima 
            Appearance      =   0  'Flat
            Height          =   2760
            Left            =   120
            TabIndex        =   10
            Top             =   120
            Width           =   6615
         End
      End
   End
End
Attribute VB_Name = "FrmPesan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Const HWND_TOPMOST = -1
Const SWP_NOSIZE = &H1
Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Declare Function BringWindowToTop Lib "user32" (ByVal hWnd As Long) As Long
Private Sub CmdHapusLog_Click()
    TxtpesanDiterima.Clear
End Sub

Private Sub CmdKirim_Click()
On Error GoTo hell
rec.Open "SELECT ip.*,port.port FROM ip,port WHERE ip.ip = port.ip AND ip.no_client = " & Val(txtnoclient.Text), conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 0 Then
 rec.Close
MsgBox "Cek No Client yang akan di balas/kirim pesan.", vbInformation

Else
    If FrmMain.Winsock(rec(2)).State = sckConnected Then
        FrmMain.Winsock(rec(2)).SendData "pesan|" & TxtPesanDiKirim.Text
        TxtpesanDiterima.AddItem FrmMain.usnm.Text & ": " & TxtPesanDiKirim.Text
        TxtPesanDiKirim.Text = ""
         rec.Close
    End If
      End If
   
  
IfNoErr:
Exit Sub
hell:
 'MsgBox "An Error In " & Me.Name & ". See Error.log for detail", vbCritical, "Error Handling"
TulisError Err.Description, Err.Number, "CmdKirim_Click", Me.Name
Resume IfNoErr

End Sub

Private Sub CmdTutup_Click()
  Unload Me
End Sub
Private Sub Form_Activate()
'On Error GoTo hell
'    Call CekClientAktif
'IfNoErr:
'Exit Sub
'hell:
' 'MsgBox "An Error In " & Me.Name & ". See Error.log for detail", vbCritical, "Error Handling"
' TulisError Err.Description, Err.Number, "Form_Activate", Me.Name
' Resume IfNoErr
End Sub

Private Sub Form_Load()
BringWindowToTop Me.hWnd
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE
StyleS
End Sub

Private Sub Form_Unload(Cancel As Integer)
    FrmPesanLoad = False
End Sub
Private Sub CekClientAktif()
'On Error GoTo hell
'    rec.Open "SELECT ip.* FROM ip", conn, adOpenStatic, adLockOptimistic
'    If Not rec.RecordCount = 0 Then
'        rec.MoveFirst
'        For i = 1 To rec.RecordCount
''            txtNoClient.AddItem rec(0)
'            rec.MoveNext
'        Next i
'        txtNoClient.ListIndex = 0
'        CmdKirim.Enabled = True
'    Else
'        CmdKirim.Enabled = False
'    End If
    rec.Close
'IfNoErr:
'Exit Sub
'hell:
' 'MsgBox "An Error In " & Me.Name & ". See Error.log for detail", vbCritical, "Error Handling"
' TulisError Err.Description, Err.Number, "CekClientAktif", Me.Name
' Resume IfNoErr

End Sub
Private Sub TxtPesanDiKirim_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call CmdKirim_Click
End If
End Sub

Private Sub StyleS()
On Error Resume Next
Dim ctrl As Control
For Each ctrl In Controls
If FrmStyles.txtnamastyle.Text = "Default" Then
Exit Sub
Else
    If (TypeOf ctrl Is ButtonNix) And _
        ctrl.Name <> "cmdSwitchStyle" Then
        ctrl.ButtonType = FrmStyles.txtlButtonType.Text
        ctrl.ColorScheme = FrmStyles.txtlColorScheme.Text
        ctrl.Backcolor = FrmStyles.txtlBackcolor.Text
        ctrl.BackOver = FrmStyles.txtlBackOver.Text
        ctrl.Forecolor = FrmStyles.txtlForecolor.Text
        ctrl.ForeOver = FrmStyles.txtlForeOver.Text
       
    End If
        If (TypeOf ctrl Is BLacKFrame) And _
        ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.BackColor1 = FrmStyles.frameBackColor1.Text
         ctrl.BackColor2 = FrmStyles.frameBackColor2.Text
         ctrl.BorderColor = FrmStyles.frameBorderColor.Text
         ctrl.Forecolor = FrmStyles.frameForecolor.Text
         ctrl.TitleColor1 = FrmStyles.frameTitleColor1.Text
         ctrl.TitleColor2 = FrmStyles.frameTitleColor2.Text
         If FrmStyles.frameBackGradient.Text = 0 Then
         ctrl.BackGradient = None
         ElseIf FrmStyles.frameBackGradient.Text = 1 Then
         ctrl.BackGradient = Vertical
         ElseIf FrmStyles.frameBackGradient.Text = 2 Then
         ctrl.BackGradient = Horizontal
         End If
         
         If FrmStyles.Frametitlegradient.Text = 0 Then
         ctrl.TitleGradient = None
         ElseIf FrmStyles.Frametitlegradient.Text = 1 Then
         ctrl.TitleGradient = Vertical
         ElseIf FrmStyles.Frametitlegradient.Text = 2 Then
         ctrl.TitleGradient = Horizontal
         End If

    End If
        If (TypeOf ctrl Is BLacKText) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.TForecolor.Text
         ctrl.Backcolor = FrmStyles.TBackcolor.Text
         ctrl.BackColorMain = FrmStyles.TBackColorMain.Text
         ctrl.BorderColor = FrmStyles.TBorderColor.Text
         ctrl.FocusBackColor = FrmStyles.TFocusBackColor.Text
         ctrl.FocusBackMainColor = FrmStyles.TFocusBackMainColor.Text
         ctrl.FocusBorderColor = FrmStyles.TFocusBorderColor.Text
         ctrl.FocusForeColor = FrmStyles.TFocusForeColor.Text
    End If
        If (TypeOf ctrl Is MSFlexGrid) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.GDBackcolor.Text
         ctrl.BackColorBkg = FrmStyles.GDBackColorBkg.Text
         ctrl.BackColorSel = FrmStyles.GDBackColorSel.Text
         ctrl.BackColorFixed = FrmStyles.GDBackColorFixed.Text
         ctrl.ForeColorSel = FrmStyles.GDForeColorSel.Text
         ctrl.Forecolor = FrmStyles.GDForecolor.Text
         ctrl.ForeColorFixed = FrmStyles.GDForeColorFixed.Text
         ctrl.GridColor = FrmStyles.GDGridColor.Text
         ctrl.GridColorFixed = FrmStyles.GDGridColorFixed.Text
    End If
        If (TypeOf ctrl Is TextBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.lbltextfore.Text
         ctrl.Backcolor = FrmStyles.lbltextback.Text
    End If
        If (TypeOf ctrl Is ComboBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.cboForeColor.Text
         ctrl.Backcolor = FrmStyles.cboBackcolor.Text
    End If
        If (TypeOf ctrl Is Label) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.lblForeColor.Text
    End If
        If (TypeOf ctrl Is RichTextBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.RcBackcolor.Text
    End If
    
            If (TypeOf ctrl Is OptionButton) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.opForecolor.Text
         ctrl.Backcolor = FrmStyles.opBackcolor.Text
    End If
            If (TypeOf ctrl Is ListView) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.LBackColor.Text
    End If
    Me.Backcolor = FrmStyles.WFore.Text
    End If
Next ctrl
End Sub

Private Sub TxtPesanDiKirim_GotFocus()
TxtPesanDiKirim.Backcolor = &H0&
TxtPesanDiKirim.Forecolor = vbWhite
End Sub
Private Sub TxtPesanDiKirim_LostFocus()
TxtPesanDiKirim.Backcolor = &H404040
TxtPesanDiKirim.Forecolor = &HC000&
End Sub

